package com.letoken.platform.repo.ecommerce.dao;

import com.letoken.platform.repo.dao.SpiceBaseMapper;
import com.letoken.platform.repo.ecommerce.po.EcommerceFootprint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 我的足迹 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2023-11-15
 */
public interface EcommerceFootprintMapper extends SpiceBaseMapper<EcommerceFootprint> {


    @Select("select 1 from ecommerce_footprint where user_id = #{userId} and product_id = #{productId} and date = #{date} limit 1")
    Integer isExists(@Param("userId") Integer userId,@Param("productId") Integer productId,@Param("date") String date );


    @Delete("delete from ecommerce_footprint where user_id = #{userId} and id in  (${ids}) ")
    int deleteFootprint(@Param("userId") Integer userId ,@Param("ids") String ids);



    @Select("select count(1) from ecommerce_footprint where user_id = #{userId} ")
    Integer footprintNum(@Param("userId") Integer userId);

}
